/**============================================================================
 Confidential Information - Limited distribution to authorized persons only.
 This software is protected as an unpublished work under the U.S. Copyright
 Act of 1976.

 Copyright (c) 2011, BluePhoenix Solutions, Inc. All rights reserved.
 ----------------------------------------------------------------------------
 file......: InfoDialog.java
 Author....: Vyacheslav Kovalyov
 Created...: 12/29/11

 Description:

 ============================================================================*/
package com.bphx.android.activities.dialogs;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.TextView;
import com.bphx.android.ui.listeners.ICancelListener;
import com.bphx.android.words.Word;

import static com.bphx.android.R.id.*;
import static com.bphx.android.R.layout.word_info_layout;
import static com.bphx.android.utils.Utils.createVariantsString;

/**
 * @author Vyacheslav Kovalyov
 * @version 1.0
 */
public class InfoWordDialog extends Dialog {

    public InfoWordDialog(Context context, Word word, final ICancelListener listener) {
        super(context);

        setContentView(word_info_layout);
        setTitle(word.getOriginalWord());

        String variants = createVariantsString(word.getVariants());
        String invalidVariants = createVariantsString(word.getInvalidTranslations());

        ((TextView) findViewById(dlgTranslationVariants)).setText(variants);
        ((TextView) findViewById(dlgInvalidTranslationVariants)).setText(invalidVariants);

        findViewById(dlgOkButton).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                cancel();
                listener.onCancel();
            }
        });
    }
}